USE [expensesystem]
GO
/****** Object:  StoredProcedure [dbo].[stp_GetAllExpenseUnSubmittedtLimited]    Script Date: 4/20/2014 12:02:37 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		HiepBui
-- Create date: 29/1/2014
-- Description:	Get user list
-- =============================================
ALTER PROCEDURE [dbo].[stp_GetAllExpenseUnSubmittedtLimited]
@UserId bigint,
@PageSize INT,
@Page INT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	SELECT 
	    E.ExpenseId AS Id,
		E.Billable AS Billable,
		E.Merchant AS Merchant,
		E.ClaimCustomer AS ClaimCustomer,
		E.Total AS Total,
		E.ReceiptId AS ReceiptId,
		EX.CategoryName AS Category,
		E.ItemDescription AS Description,
		E.Comment AS Comment,
		E.Date AS Date,
		E.CurrencyId AS CurrencyId,
		E.Exchangerate AS ExchangeRate
		
	FROM 
	   expense AS E
	   LEFT JOIN expensecategory AS EX ON E.CategoryId = EX.CategoryId
	WHERE
	       E.Status = 1
		 AND
		    E.UserId = @UserId
END